<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script>
//var re = /[a-zA-Z0-9_]/g;
//var re = /[^abcz]/gi   // ^ 放在方括号中, 表示非
//var re = /\d/g;   // [0-9]
//var re = /\D/g;   // [^0-9]
//var re = /\w/g;  // [a-zA-Z0-9_]  word
//var re = /\W/g;  // [^a-zA-Z0-9_]
//var re = /\s\s/g;  // 匹配空白字符
//var re = /\S/g;  // 只要不是空白字符就匹配
var re = /^\d\d\d$/g;   // 检测字符串是否已后面的字符开始
var s = "123";
console.log(re.test(s));

</script>
</body>
</html>